<template>
	<a-select :options="deptList" v-model="modelValue"  :field-names="fieldNames" :placeholder="$t('base.placeholderSelect') + $t('base.dept')" :virtual-list-props="{ height: 350 }" />
</template>

<script setup lang="ts">
import { getDeptList } from "@/api/common";
const deptList = ref([]);
const fieldNames = { value: "id", label: "name" };
const props = defineProps({
	modelValue: {
		type: Array,
		default: () => []
	}
})
const emit = defineEmits(['update:modelValue'])
const modelValue = computed({
	get() {
		return props.modelValue
	},
	set: (val) => {
		emit('update:modelValue', val)
	}
})
const getList = async () => {
	const data = await getDeptList({});
	deptList.value = data;
};
onMounted(() => {
	getList();
});
</script>

<style scoped lang="scss">
.post,
.dept {
	font-size: 12px;
	color: #999;
	line-height: 2;
}
</style>
